package com.gt.quality.apim.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * API参数数据集表(ApiParamInfo)表实体类
 *
 * @author makejava
 * @since 2026-11-20 09:51:37
 */
@Data
@Accessors(chain = true)
@Schema(title = "ApiParamInfo", description = "API参数数据集表")
@TableName(value = "api_param_info", autoResultMap = true)
public class ApiParamInfo implements Serializable {
    @Serial
	private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(title = "id",description = "主键id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    /**
     * API主表Id
     */
    @TableField(value = "api_info_id")
    @Schema(title = "api_info_id",description = "API主表Id")
    private Long apiInfoId;

    /**
     * 参数类型:100-变量|200-常量
     */
    @TableField(value = "param_define_type")
    @Schema(title = "param_define_type",description = "参数类型:100-变量|200-常量")
    private Integer paramDefineType;

    /**
     * 参数名称
     */
    @TableField(value = "param_name")
    @Schema(title = "param_name",description = "参数名称")
    private String paramName;

    /**
     * 参数位置:body/query/path/header
     */
    @TableField(value = "param_position")
    @Schema(title = "param_position",description = "参数位置:body/query/path/header")
    private String paramPosition;

    /**
     * 参数类型:String/Integer/Boolean/JSON/Array
     */
    @TableField(value = "param_category")
    @Schema(title = "param_category",description = "参数类型:String/Integer/Boolean/JSON/Array")
    private String paramCategory;

    /**
     * 是否是数组:100-否、200-是
     */
    @TableField(value = "param_is_array")
    @Schema(title = "param_is_array",description = "是否是数组:100-否、200-是")
    private Integer paramIsArray;

    /**
     * 是否必要：100-否、200-是
     */
    @TableField(value = "param_is_require")
    @Schema(title = "param_is_require",description = "是否必要：100-否、200-是")
    private Integer paramIsRequire;

    /**
     * 参数描述
     */
    @TableField(value = "param_desc")
    @Schema(title = "param_desc",description = "参数描述")
    private String paramDesc;

    /**
     * 参数的值
     */
    @TableField(value = "param_default_value")
    @Schema(title = "param_default_value",description = "参数的值")
    private String paramDefaultValue;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @Schema(title = "create_time",description = "创建时间")
    private Date createTime;

    @TableField(value = "create_by")
    @Schema(title = "create_by",description = "创建人")
    private String createBy;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @Schema(title = "update_time",description = "修改时间")
    private Date updateTime;

    @TableField(value = "update_by")
    @Schema(title = "update_by",description = "修改人")
    private String updateBy;

    @TableField(value = "delete_flag")
    @Schema(title = "delete_flag",description = "0存在 1删除")
    @TableLogic(delval = "1",value  ="0")
    private Integer deleteFlag;

    @TableField(value = "create_dept")
    @Schema(title = "create_dept",description = "${column.comment}")
    private String createDept;


    /**
     * API字段取值所来源API的值
     */
    @TableField(value = "api_relationship_interface_id")
    @Schema(title = "api_relationship_interface_id",description = "${column.comment}")
    private String apiRelationshipInterfaceId;

    @TableField(exist = false)
    private ApiRelationshipInterfaceInfo interfaceInfo;

    /*绑定id，报告模版使用*/
    @TableField(exist = false)
    private String bindCustomId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ApiParamInfo paramInfo = (ApiParamInfo) o;
        return Objects.equals(id, paramInfo.id) && Objects.equals(apiInfoId, paramInfo.apiInfoId) && Objects.equals(paramDefineType, paramInfo.paramDefineType) && Objects.equals(paramName, paramInfo.paramName) && Objects.equals(paramPosition, paramInfo.paramPosition) && Objects.equals(paramCategory, paramInfo.paramCategory) && Objects.equals(paramIsArray, paramInfo.paramIsArray) && Objects.equals(paramIsRequire, paramInfo.paramIsRequire) && Objects.equals(paramDesc, paramInfo.paramDesc) && Objects.equals(paramDefaultValue, paramInfo.paramDefaultValue) && Objects.equals(createTime, paramInfo.createTime) && Objects.equals(createBy, paramInfo.createBy) && Objects.equals(updateTime, paramInfo.updateTime) && Objects.equals(updateBy, paramInfo.updateBy) && Objects.equals(deleteFlag, paramInfo.deleteFlag) && Objects.equals(createDept, paramInfo.createDept);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, apiInfoId, paramDefineType, paramName, paramPosition, paramCategory, paramIsArray, paramIsRequire, paramDesc, paramDefaultValue, createTime, createBy, updateTime, updateBy, deleteFlag, createDept);
    }
}


